package cn.legend.travel.destination.keyword.controller;


import cn.legend.travel.common.web.JsonResult;
import cn.legend.travel.destination.keyword.pojo.po.HotMonthDestinationPO;
import cn.legend.travel.destination.keyword.service.IDistrictService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 处理省市区相关请求的控制器
 *
 * @author java@tedu.cn
 * @version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/dict/")
@Validated
@Api(tags = "1.查询目的地")
public class DistrictController {

    @Autowired
    private IDistrictService districtService;

    public DistrictController() {
        log.debug("创建控制器类对象：DistrictController");
    }

    @GetMapping("/getHotKeywordDestination")
    @ApiOperation("根据父级查询子级地区列表")
    @ApiOperationSupport(order = 420)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "关键词类型，默认为时间", required = true, dataType = "String", example = "时间")
    })
    public JsonResult MonthDestinationList(@RequestParam String type) {
        List<HotMonthDestinationPO> districtList = districtService.listByType(type);
        return JsonResult.ok(districtList);
    }

}
